# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-python-nmap
pkgname=('python2-python-nmap' 'python-python-nmap')
_pkgname=python-nmap
pkgver=0.7.1
pkgrel=1
pkgdesc='Python class to use nmap and access scan results from python3.'
arch=('any')
url='https://pypi.org/project/python-nmap/#files'
license=('GPL3')
makedepends=('python2-setuptools' 'python-setuptools' 'python2-pip' 'python-pip'
             'python2-wheel' 'python-wheel')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('3a1d3b7120527d56148ddf3589bf8c4b749bb549e93c65a973d3edacb492656d0060d82606f88c5d1342dabdce00b8957bf09e01a5ce42f3a670ff3778d9e0ea')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-python-nmap() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-python-nmap() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

